// -----------------------------------------------------------------------
//  <copyright file="AuthConfigAttribute.cs" company="LiuliuSoft">
//      Copyright (c) 2022-2025 DaprPlus. All rights reserved.
//  </copyright>
//  <site>https://dapr.plus</site>
//  <last-editor>郭明锋</last-editor>
//  <last-date>2025-03-08 23:03</last-date>
// -----------------------------------------------------------------------

namespace DaprPlus.Authorization;

[AttributeUsage(AttributeTargets.Class)]
public class AuthConfigAttribute(Type resourceType, ResourceAccessType accessType, string operation) : Attribute()
{
    public Type ResourceType { get; } = resourceType;

    public ResourceAccessType AccessType { get; } = accessType;

    public string Operation { get; } = operation;

    public AuthConfig ToAuthConfig()
    {
        return new AuthConfig(ResourceType.FullName!, AccessType, Operation);
    }
}
